package com.buba.springboot.utils;

import java.util.Random;

public class RandomUtils {
    /**
     * 禁用构造函数
     */
    private RandomUtils(){

    }


    /**
     * 生成6位数的随机验证码
     * @return
     */
    public static String getSixCode(){
        Random random=new Random();
        StringBuilder stringBuilder=new StringBuilder();
        for (int i=0;i<6;i++){
            //生成10以内的随机数
            int nums = random.nextInt(10);
            stringBuilder.append(nums);
        }
        return stringBuilder.toString();
    }
}
